<layout name="Layout/main" />
<div class="table panel panel-default">
	<div class="panel-heading">
		<span>您正在为用户组 <strong class='text-success'>{$rname}</strong>
			配置权限
		</span>
	</div>

	<!-- Table -->

	<div class="container-fluid ">
		<empty name='list'> 暂无任何权限！ <else /> <volist name="list"
			id='vo'> <if condition="$vo['lev'] neq 3">
		<div class="row">
			<span <if condition="$vo['lev'] eq 1"> style="padding-left:{$vo['lev']*15}px;"
				<elseif condition="$vo['lev'] eq 2" /> style="padding-left:{$vo['lev']*15}px;" </if> ><label style="font-weight:normal"><input
					name="node" level="{$vo.level}" id="{$vo.id}" pid="{$vo.pid}"
				<if condition="$vo['access'] eq 1">checked="checked" </if>
					type='checkbox' value="{$vo.id}" /> {$vo.title}</label></span>
		</div>

		<else /> <span style="margin-left: 30px"><label style="font-weight:normal" >
		<input name="node" level="{$vo.level}" id="{$vo.id}" pid="{$vo.pid}"
			<if condition="$vo['access'] eq 1">checked="checked" </if>
				type='checkbox' value="{$vo.id}" /> {$vo.title}</label></span> </if> </volist> </empty>
	
	<div class="panel " style="margin:30px">
		<button class="btn btn-success" id='save'>确认授权</button>
	</div>
	
	</div>
	<!-- js 出场 -->
	<script src="__PUBLIC__/js/bigpiao.js"></script>
	<script>
		$("input[name='node']")
				.on(
						'click',
						function() {
							var id = $(this).val();
							var pid = $(this).attr('pid');
							var level = $(this).attr('level');

							if (level == 1) {
								var inputs = $("input[name='node']");
								$(this).is(":checked") ? inputs.prop('checked',
										true) : inputs.prop('checked', false);
							}

							if (level == 2) {
								var inputs = $("input[pid='" + id + "']");
								$(this).is(":checked") ? inputs.prop('checked',
										true) : inputs.prop('checked', false);
							}

							if (level == 3) {
								if ($(this).is(":checked")) {
									var inputs = $("input[id='" + pid + "']")
											.prop('checked', true);
									var ppid = $("input[id='" + pid + "']")
											.attr('pid');
									$("input[id='" + ppid + "']").prop(
											'checked', true);
								}
							}
						})
	</script>
	<script>
		/*  bigpiao.sNode();
		 bigpiao.sReNode(); */
		bigpiao.saveNode("{:U('rbc/setrole')}", {$rid});
	</script>